﻿using JX.Core;
using JX.Core.Entity;
using JX.Dapper;
using JX.Infrastructure.Common;
using JX.Infrastructure.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace JX.Application
{
	/// <summary>
	/// 商品管理服务层接口
	/// </summary>
	public partial class CommonProductServiceAppDapper : ServiceAppDapper<CommonProductEntity>,ICommonProductServiceAppDapper
	{
		#region 仓储接口
		private readonly IUnitOfWorkFactory _uowFactory;
		private readonly ILogRepositoryDapper _LogRepository;
		/// <summary>
		/// 构造器注入
		/// </summary>
		public CommonProductServiceAppDapper(ICommonProductRepositoryDapper repository,
			ILogRepositoryDapper logRepository,
			IUnitOfWorkFactory uowFactory) : base(repository)
		{
			m_repository = repository;
			_LogRepository = logRepository;
			_uowFactory = uowFactory;
		}
		#endregion

		#region 是否存在数据
		/// <summary>
		/// 判断目标商品类型中是否包含指定源商品类型
		/// </summary>
		/// <param name="target">目标商品类型</param>
		/// <param name="source">源商品类型</param>
		/// <returns></returns>
		public bool CharacterIsExists(ProductCharacter target, ProductCharacter source) 
		{
			if (source == ProductCharacter.None)
			{
				return false;
			}
			return (target & source) == source;
		}
		#endregion
	}
}